package com.sgolub.commanndsonline.domain.sec;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonBackReference;
import org.codehaus.jackson.map.annotate.JsonSerialize;

import com.sgolub.commanndsonline.domain.ref.UserType;
import com.sgolub.commanndsonline.helpers.CustomDateSerializer;

@Entity
@Table(name = "SEC_USER")
public class SecUser {
	
    @Id
    @Column(name = "ID")
    @GeneratedValue 
    private Integer id;

    @Column(name = "NAME")
    private String name;

    @Column(name = "PASSWORD")
    private String password;

    @Column(name = "ENABLED")
    private Integer enabled;
    
    @Column(name = "EMAIL")
    private String email;
    
    @Column(name = "COMPANY")
    private String company;

    @Column(name = "USERNAME")
    private String username;
    
    @Column(name = "TELEFON")
    private String telefon;
    
    @Column(name = "REG_DATE")
    private Date regDate;
    
    
    @OneToOne
    @JoinColumn(name = "ROLE_ID")
    private SecRole secRole;
    
    @OneToOne
    @JoinColumn(name = "REF_USER_TYPE_ID") 
    private UserType userType;

    //@JsonBackReference
    @OneToOne
    @JoinColumn(name="MANAGER_ID")
    private SecUser manager;
    
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Integer getEnabled() {
		return enabled;
	}

	public void setEnabled(Integer enabled) {
		this.enabled = enabled;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
	
	public String getTelefon() {
		return telefon;
	}

	public void setTelefon(String telefon) {
		this.telefon = telefon;
	}

	@JsonSerialize(using = CustomDateSerializer.class)
	public Date getRegDate() {
		return regDate;
	}

	public void setRegDate(Date regDate) {
		this.regDate = regDate;
	}

	public SecRole getSecRole() {
		return secRole;
	}

	public void setSecRole(SecRole secRole) {
		this.secRole = secRole;
	}

	public UserType getUserType() {
		return userType;
	}

	public void setUserType(UserType userType) {
		this.userType = userType;
	}

	
	public SecUser getManager() {
		return manager;
	}

	
	public void setManager(SecUser manager) {
		this.manager = manager;
	}
 

}
